package cn.iocoder.yudao.module.alipay.dal.mysql.cpsactivitytype;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.cpsactivitytype.CpsActivityTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.admin.cpsactivitytype.vo.*;

/**
 * cps活动分类 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CpsActivityTypeMapper extends BaseMapperX<CpsActivityTypeDO> {

    default PageResult<CpsActivityTypeDO> selectPage(CpsActivityTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CpsActivityTypeDO>()
                .eqIfPresent(CpsActivityTypeDO::getActCode, reqVO.getActCode())
                .eqIfPresent(CpsActivityTypeDO::getName, reqVO.getName())
                .eqIfPresent(CpsActivityTypeDO::getParentId, reqVO.getParentId())
                .eqIfPresent(CpsActivityTypeDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CpsActivityTypeDO::getTypeLevel, reqVO.getTypeLevel())
                .eqIfPresent(CpsActivityTypeDO::getSort, reqVO.getSort())
                .betweenIfPresent(CpsActivityTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CpsActivityTypeDO::getId));
    }

    default List<CpsActivityTypeDO> selectList(CpsActivityTypeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CpsActivityTypeDO>()
                .eqIfPresent(CpsActivityTypeDO::getActCode, reqVO.getActCode())
                .eqIfPresent(CpsActivityTypeDO::getName, reqVO.getName())
                .eqIfPresent(CpsActivityTypeDO::getParentId, reqVO.getParentId())
                .eqIfPresent(CpsActivityTypeDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CpsActivityTypeDO::getTypeLevel, reqVO.getTypeLevel())
                .eqIfPresent(CpsActivityTypeDO::getSort, reqVO.getSort())
                .betweenIfPresent(CpsActivityTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CpsActivityTypeDO::getId));
    }

}
